The Universal Serial Bus (USB) is a cable bus that supports data exchange between a host computer and a wide range of simultaneously accessible peripheral devices. The attached peripheral devices share USB bandwidth through a host-scheduled, token-based protocol. The bus allows peripherals to be attached, configured, used, and detached while the host and other peripherals are in operation.
The USB is defined by a specification that is approved by a committee of industry representatives. The specification covers all aspects of USB operation, including electrical, mechanical, and communications characteristics. To be called a USB device, a peripheral must conform to this very exacting specification.
USB device information is typically stored in so-called “descriptors” or request codes—data structures formatted as specified by the USB specification. Descriptors are used in a USB system to define “device requests” from a host to a peripheral device. A device request is a data structure that is conveyed in a “control transfer” from the host to the peripheral device. A control transfer contains the following fields:                bmRequestType—a mask field indicating (a) the direction of data transfer in a subsequent phase of the control transfer; (b) a request type (standard, class, vendor, or reserved); and (c) a recipient (device, interface, endpoint, or other). The primary types of requests specified in the “request type” field are the “standard” and “vendor” types, which will be discussed below.        bRequest—a request code indicating one of a plurality of different commands to which the device is responsive.        wValue—a field that varies according to the request specified by bRequest.        wIndex—a field that varies according to request; typically used to pass an index or offset as part of the specified request.        wLength—number of bytes to transfer if there is a subsequent data stage.        
All USB devices are supposed to support and respond to “standard” requests—referred to herein as “USB-specific” requests. In USB-specific requests, the request type portion of the bmRequestType field contains a predefined value indicative of the “standard” request type.
Each different USB-specific request has a pre-assigned USB-specific request code, defined in the USB specification. This is the value used in the bRequest field of the device request, to differentiate between different USB-specific requests. For each USB-specific request code, the USB specification sets forth the meanings of wValue and wIndex, as well as the format of any returned data.
USB devices can optionally support “vendor” requests—referred to herein as “device-specific” requests. In a device-specific request, the request type portion of the bmRequestType field contains a predefined value to indicate a “vendor” request type. In the case of device-specific requests, the USB specification does not assign request codes, define the meanings of wValue and wIndex, or define the format of returned data. Rather, each device has nearly complete control over the meaning, functionality, and data format of device-specific requests. Specifically, the device can define its own requests and assign device-specified request codes to them. This allows devices to implement their own device requests for use by host computers, and provides tremendous flexibility for manufacturers of peripherals.